(function() {
	'use strict';
	var sc = angular.module('sc');
	sc.controller('AdminWorkExpCtrl', AdminWorkExpCtrl);
	function AdminWorkExpCtrl($http) {
		var ctrl = this;
		this.queryWorkExp = function(status, type, student, grade, dep, major, sex, pageNumber, pageSize) {
			var params = {
				status : status,
				student : student,
				grade : grade,
				department : dep,
				major : major,
				sex : sex,
				type : type,
				pageNumber : pageNumber,
				pageSize : pageSize
			}
			return $http.post(':sc:workExp/queryWorkExp', params).success(function(r) {
				ctrl.result = r
				return r;
			});
		}
		this.getWorkExpsForExamine = function(status, type, student, grade, dep, major, sex, pageNumber, pageSize) {
			var params = {
				status : status,
				student : student,
				grade : grade,
				dep : dep,
				major : major,
				sex : sex,
				type : type,
				pageNumber : pageNumber,
				pageSize : pageSize
			}
			return $http.post(':sc:workExp/getWorkExpsForExamine', params).success(function(r) {
				ctrl.result = r
				return r;
			});
		}
		this.queryMajor = function(department) {
			return $http.post(':sc:major/getMajors', {
				department : department
			}).success(function(r) {
				ctrl.majors = r
				return r;
			})
		}
		this.queryDepartment = function() {
			return $http.post(':sc:department/queryByStatusAndType', {
				status : 1,
				type : 1
			}).success(function(r) {
				ctrl.departments = r
				return r;
			})
		}
		this.audit = function(audit) {
			return $http.post(':sc:audit/doAudit', audit);
		}
		this.getAudits = function(id) {
			return $http.post(':sc:audit/getAudits', {
				id : id
			})
		}
		this.findByStuID = function(stuId) {
			return $http.post(':sc:audit/findByStuID', {
				stuId : stuId
			})
		}
		// 年级、类型分组统计成绩
		this.builAnalysis = function(year) {
			return $http.post(':sc:workExp/builAnalysis', {
				year : year,
			}).success(function(r) {
				ctrl.result = r
				return r;
			})
		}
	}
})()